home *** CD-ROM | disk | FTP | other *** search
/ Windows 6-Pak - Disc 5 / Windows 6-Pak (InfoMagic) (Disc 5) (1999).ISO / Misc-Programming-Tools / rlbare12.exe / Rlbar.cab / Form1.frm < prev    next >
Text File  |  1998-10-05  |  15KB  |  399 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "RLBar BarCode OCX Extra Version DEMO"
  5.    ClientHeight    =   5952
  6.    ClientLeft      =   1128
  7.    ClientTop       =   756
  8.    ClientWidth     =   6696
  9.    Height          =   6336
  10.    Left            =   1080
  11.    LinkTopic       =   "Form1"
  12.    MousePointer    =   2  'Cross
  13.    ScaleHeight     =   5952
  14.    ScaleWidth      =   6696
  15.    Top             =   420
  16.    Width           =   6792
  17.    Begin VB.CommandButton Command2 
  18.       Caption         =   "Test Print All BarCode"
  19.       Height          =   405
  20.       Left            =   4740
  21.       MousePointer    =   1  'Arrow
  22.       TabIndex        =   9
  23.       Top             =   630
  24.       Width           =   1875
  25.    End
  26.    Begin VB.PictureBox Picture1 
  27.       Appearance      =   0  'Flat
  28.       AutoRedraw      =   -1  'True
  29.       BackColor       =   &H80000005&
  30.       ForeColor       =   &H80000008&
  31.       Height          =   2505
  32.       Left            =   0
  33.       MousePointer    =   2  'Cross
  34.       ScaleHeight     =   2484
  35.       ScaleWidth      =   6648
  36.       TabIndex        =   6
  37.       Top             =   3450
  38.       Width           =   6675
  39.    End
  40.    Begin VB.CommandButton Command1 
  41.       Caption         =   "Output To Printer"
  42.       Height          =   525
  43.       Left            =   4740
  44.       MousePointer    =   1  'Arrow
  45.       TabIndex        =   3
  46.       Top             =   90
  47.       Width           =   1875
  48.    End
  49.    Begin VB.Frame Frame1 
  50.       Caption         =   "BarCode"
  51.       Height          =   915
  52.       Left            =   60
  53.       TabIndex        =   0
  54.       Top             =   60
  55.       Width           =   4635
  56.       Begin VB.TextBox Text1 
  57.          Height          =   285
  58.          Left            =   1620
  59.          MousePointer    =   3  'I-Beam
  60.          TabIndex        =   8
  61.          Text            =   "123456789012"
  62.          Top             =   570
  63.          Width           =   2925
  64.       End
  65.       Begin VB.ComboBox Combo1 
  66.          Height          =   315
  67.          Left            =   1620
  68.          MousePointer    =   1  'Arrow
  69.          Style           =   2  'Dropdown List
  70.          TabIndex        =   1
  71.          Top             =   210
  72.          Width           =   2955
  73.       End
  74.       Begin VB.Label Label4 
  75.          AutoSize        =   -1  'True
  76.          Caption         =   "Press BarCode Code"
  77.          Height          =   195
  78.          Left            =   60
  79.          TabIndex        =   7
  80.          Top             =   600
  81.          Width           =   1470
  82.       End
  83.       Begin VB.Label Label1 
  84.          AutoSize        =   -1  'True
  85.          Caption         =   "Select BarCode Type"
  86.          Height          =   195
  87.          Left            =   60
  88.          TabIndex        =   2
  89.          Top             =   270
  90.          Width           =   1515
  91.       End
  92.    End
  93.    Begin RLBARPRO.RLBar RLBar1 
  94.       Left            =   5760
  95.       Top             =   1392
  96.       _ExtentX        =   699
  97.       _ExtentY        =   699
  98.    End
  99.    Begin VB.Label Label3 
  100.       AutoSize        =   -1  'True
  101.       BackStyle       =   0  'Transparent
  102.       Caption         =   "Click Picture1 Can Show Barcode on Picture1 that mouse position"
  103.       Enabled         =   0   'False
  104.       Height          =   195
  105.       Left            =   60
  106.       TabIndex        =   5
  107.       Top             =   3240
  108.       Width           =   4665
  109.    End
  110.    Begin VB.Label Label2 
  111.       AutoSize        =   -1  'True
  112.       BackStyle       =   0  'Transparent
  113.       Caption         =   "Click Form1 Can Show Barcode on Form1 that mouse position"
  114.       Enabled         =   0   'False
  115.       Height          =   195
  116.       Left            =   90
  117.       TabIndex        =   4
  118.       Top             =   990
  119.       Width           =   4365
  120.    End
  121. End
  122. Attribute VB_Name = "Form1"
  123. Attribute VB_Creatable = False
  124. Attribute VB_Exposed = False
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140. Public Sub MakeBarDraw(pObject As Object, pX As Single, pY As Single)
  141.   Dim tmpBarText As String
  142.  
  143.   'Get the BarCode's Code
  144.   tmpBarText = Text1.Text
  145.  
  146.   'Important!! The [pObject] must can support the
  147.   '                  Drawing Method ,
  148.   '                  eg: [Cls] Method & [Line] Method
  149.  
  150.   'Clear pObject
  151.   pObject.Cls
  152.   
  153.   'Draw the BarCode Type that selected of Combo1
  154.   'Draw in pObject
  155.   'CurrentX & Y is mouse location.
  156.   'Code is 1234567890
  157.   'Width is 20,Height is 500
  158.   'Show the Code Text Below
  159.   'Standard Font (No Bold, No Italic or Underline)
  160.   'Font Name is Arial
  161.   'Font Color is Blue (1), BarCode Color is Black (0)
  162.   'Barcode Narrow is 5:2
  163.   'and also show CheckSum.
  164.   
  165.   Select Case Combo1.ListIndex
  166.     Case 0 'CODABAR (must has 2,4,6,8...etc digits)
  167.       RLBar1.BarCODABAR pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  168.     Case 1 'Code 11
  169.       RLBar1.BarCODE11 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  170.     Case 2 'Code128 (must Start With A,B or C)
  171.       RLBar1.BarCODE128 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  172.     Case 3 'Code25
  173.       RLBar1.BarCODE25 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  174.     Case 4 'Code 39
  175.       RLBar1.BarCODE39 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  176.     Case 5 'Code 39 Extend Full ASCII
  177.       RLBar1.BarCODE39F pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  178.     Case 6 'Code 93
  179.       RLBar1.BarCODE93 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  180.     Case 7 'EAN-13 (must be 12 digits)
  181.       RLBar1.BarEAN13 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  182.     Case 8 'EAN-8 (must be 7 digits)
  183.       RLBar1.BarEAN8 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  184.     Case 9 'ISBN
  185.       RLBar1.BarISBN pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  186.     Case 10 'Code MSI
  187.       RLBar1.BarMSI pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  188.     Case 11 'PostNet (must be 5,6,9 digits)
  189.       RLBar1.BarPOSTNET pObject, pX, pY, tmpBarText, 20, 100, 0, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  190.     Case 12 'UPC-A (must be 11 digits)
  191.       RLBar1.BarUPCA pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  192.     Case 13 'UPC-A Plus (must be 11 digits)
  193.       RLBar1.BarUPCAPlus pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  194.     Case 14 'UPC-E (must be 6 digits)
  195.       RLBar1.BarUPCE pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  196.   End Select
  197.   
  198. End Sub
  199.  
  200.  
  201. Public Sub MakeBarToPrinter(pX As Single, pY As Single)
  202.   Dim tmpBarText As String
  203.  
  204.   'Get the BarCode's Code
  205.   tmpBarText = Text1.Text
  206.  
  207.   '/// in here, we output to printer use set pObject to Printer Object
  208.  
  209.   'Draw the BarCode Type that selected of Combo1
  210.   'Draw in printer buffer
  211.   'CurrentX & Y is mouse location.
  212.   'Code is 1234567890
  213.   'Width is 10,Height is 500
  214.   'Show the Code Text Below
  215.   'Standard Font (No Bold, No Italic or Underline)
  216.   'Font Name is Arial
  217.   'Font Color is Blue (1), BarCode Color is Black (0)
  218.   'Barcode Narrow is 3:1
  219.   'and also show CheckSum.
  220.   
  221.   Select Case Combo1.ListIndex
  222.     Case 0 'CODABAR (must has 2,4,6,8...etc digits)
  223.       RLBar1.BarCODABAR Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  224.     Case 1 'Code 11
  225.       RLBar1.BarCODE11 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  226.     Case 2 'Code128 (must Start With A,B or C)
  227.       RLBar1.BarCODE128 Printer, pX, pY, tmpBarText, 20, 400, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  228.     Case 3 'Code25
  229.       RLBar1.BarCODE25 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  230.     Case 4 'Code 39
  231.       RLBar1.BarCODE39 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  232.     Case 5 'Code 39 Extend Full ASCII
  233.       RLBar1.BarCODE39F Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  234.     Case 6 'Code 93
  235.       RLBar1.BarCODE93 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  236.     Case 7 'EAN-13 (must be 12 digits)
  237.       RLBar1.BarEAN13 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  238.     Case 8 'EAN-8 (must be 7 digits)
  239.       RLBar1.BarEAN8 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  240.     Case 9 'ISBN
  241.       RLBar1.BarISBN Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  242.     Case 10 'Code MSI
  243.       RLBar1.BarMSI Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  244.     Case 11 'PostNet (must be 5,6,9 digits)
  245.       RLBar1.BarPOSTNET Printer, pX, pY, tmpBarText, 20, 500, 0, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  246.     Case 12 'UPC-A (must be 11 digits)
  247.       RLBar1.BarUPCA Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  248.     Case 13 'UPC-A Plus (must be 11 digits)
  249.       RLBar1.BarUPCAPlus Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  250.     Case 14 'UPC-E (must be 6 digits)
  251.       RLBar1.BarUPCE Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  252.   End Select
  253.   
  254.   Printer.EndDoc
  255.   
  256. End Sub
  257.  
  258.  
  259.  
  260.  
  261. Private Sub Command1_Click()
  262.   'When user click on Command1
  263.   'This Event will be active
  264.   
  265.   'then call the function of draw BarCode to printer
  266.   Call MakeBarToPrinter(0, 0)
  267. End Sub
  268.  
  269. Private Sub Command2_Click()
  270. Dim tmpResult As Integer
  271.   Dim pX As Single
  272.   Dim pY As Single
  273.   
  274.   pX = 500
  275.   pY = 10
  276.   tmpStep = 1000
  277.     
  278. 'CODABAR (must has 2,4,6,8...etc digits)
  279.       Printer.CurrentX = 3000
  280.       Printer.Print "CODABAR"
  281.       RLBar1.BarCODABAR Printer, pX, pY, "A123456A", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  282.       pY = pY + tmpStep
  283. 'Code 11
  284.       Printer.CurrentX = 3000
  285.       Printer.Print "Code 11"
  286.       RLBar1.BarCODE11 Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  287.       pY = pY + tmpStep
  288. 'Code128 (must Start With A,B or C)
  289.       Printer.CurrentX = 3000
  290.       Printer.Print "Code 128"
  291.       RLBar1.BarCODE128 Printer, pX, pY, "C123456", 20, 400, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  292.       pY = pY + tmpStep
  293. 'Code25
  294.       Printer.CurrentX = 3000
  295.       Printer.Print "Code 25"
  296.       RLBar1.BarCODE25 Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  297.       pY = pY + tmpStep
  298. 'Code 39
  299.       Printer.CurrentX = 3000
  300.       Printer.Print "Code 39"
  301.       RLBar1.BarCODE39 Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  302.       pY = pY + tmpStep
  303. 'Code 39 Extend Full ASCII
  304.       Printer.CurrentX = 3000
  305.       Printer.Print "Code 39 Full ASCII"
  306.       RLBar1.BarCODE39F Printer, pX, pY, "ABC", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  307.       pY = pY + tmpStep
  308. 'Code 93
  309.       Printer.CurrentX = 3000
  310.       Printer.Print "Code 93"
  311.       RLBar1.BarCODE93 Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  312.       pY = pY + tmpStep
  313. 'EAN-13 (must be 12 digits)
  314.       Printer.CurrentX = 3000
  315.       Printer.Print "EAN-13"
  316.       RLBar1.BarEAN13 Printer, pX, pY, "123456789012", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  317.       pY = pY + tmpStep
  318. 'EAN-8 (must be 7 digits)
  319.       Printer.CurrentX = 3000
  320.       Printer.Print "EAN-8"
  321.       RLBar1.BarEAN8 Printer, pX, pY, "1234567", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  322.       pY = pY + tmpStep
  323. 'ISBN
  324.       Printer.CurrentX = 3000
  325.       Printer.Print "ISBN Code"
  326.       RLBar1.BarISBN Printer, pX, pY, "123456789", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  327.       pY = pY + tmpStep + 500
  328. 'Code MSI
  329.       Printer.CurrentX = 3000
  330.       Printer.Print "MSI Code"
  331.       RLBar1.BarMSI Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  332.       pY = pY + tmpStep
  333. 'PostNet (must be 5,6,9 digits)
  334.       Printer.CurrentX = 3000
  335.       Printer.Print "PostNet"
  336.       RLBar1.BarPOSTNET Printer, pX, pY, "123456789", 20, 100, 0, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  337.       pY = pY + tmpStep - 500
  338. 'UPC-A (must be 11 digits)
  339.       Printer.CurrentX = 3000
  340.       Printer.Print "UPC-A"
  341.       RLBar1.BarUPCA Printer, pX, pY, "12345678901", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  342.       pY = pY + tmpStep
  343. 'UPC-A Plus (must be 11 digits)
  344.       Printer.CurrentX = 3000
  345.       Printer.Print "UPC-A +"
  346.       RLBar1.BarUPCAPlus Printer, pX, pY, "12345678901", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  347.       pY = pY + tmpStep
  348. 'UPC-E (must be 6 digits)
  349.       Printer.CurrentX = 3000
  350.       Printer.Print "UPC-E"
  351.       RLBar1.BarUPCE Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  352.       pY = pY + tmpStep
  353.   
  354.   Printer.EndDoc
  355.  
  356. End Sub
  357.  
  358. Private Sub Form_Load()
  359.     Combo1.AddItem "Codabar"
  360.     Combo1.AddItem "Code_11"
  361.     Combo1.AddItem "Code_128"
  362.     Combo1.AddItem "Code_25"
  363.     Combo1.AddItem "Code_39"
  364.     Combo1.AddItem "Code_39F"
  365.     Combo1.AddItem "Code_93"
  366.     Combo1.AddItem "EAN_13"
  367.     Combo1.AddItem "EAN_8"
  368.     Combo1.AddItem "ISBN"
  369.     Combo1.AddItem "Code_MSI"
  370.     Combo1.AddItem "PostNet"
  371.     Combo1.AddItem "UPC_A"
  372.     Combo1.AddItem "UPC_A_Plus"
  373.     Combo1.AddItem "UPC_E"
  374.     
  375.     Combo1.ListIndex = 4
  376. End Sub
  377.  
  378.  
  379. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  380.   'When user click on Form1
  381.   'This Event will be active
  382.   
  383.   'then call the function of draw BarCode on Form1
  384.   Call MakeBarDraw(Form1, X, Y)
  385. End Sub
  386.  
  387.  
  388.  
  389.  
  390. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  391.   'When user click on Picture1
  392.   'This Event will be active
  393.   
  394.   'then call the function of draw BarCode on Picture1
  395.   Call MakeBarDraw(Picture1, X, Y)
  396. End Sub
  397.  
  398.  
  399.